<template>
  <div class="app-container">



    <el-row>
      <el-table ref="tables1" :data="form.ucQuoProjects" :row-key="row => row.id">

        <el-table-column label="序号" align="center" prop="indexNo" width="50"/>
        <el-table-column label="指标类型" align="center" prop="quotaType" width="100">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.quota_type" :value="scope.row.quotaType"/>
          </template>
        </el-table-column>
        <el-table-column label="项目" align="center" prop="name"/>
        <el-table-column label="项目分数" align="center" prop="score" width="50">
          <template slot-scope="scope">
            {{scope.row.score1 != 0 ? scope.row.score1 : ''}}
            {{scope.row.score2 != 0 ? ('(' + scope.row.score2 + ')') : ''}}
          </template>
        </el-table-column>
        <el-table-column label="明细" align="center" prop="ucQuoProjectItems" width="700">
          <template slot-scope="scope">
            <el-row v-if="scope.row.chooseType ==1" >
              <el-col :span="6" style="min-height: 1px;">
                <el-col :span="24" v-if="scope.row.ucQuoProjectItems[0].num && scope.row.ucQuoProjectItems[0].num > 0">
                  {{ (scope.row.ucQuoProjectItems[0].scoreText1 > 0 ? scope.row.ucQuoProjectItems[0].scoreText1 : '') + (scope.row.ucQuoProjectItems[0].scoreText2 > 0 ? ('(' + scope.row.ucQuoProjectItems[0].scoreText2 + ')') : '') + '分'}} ×
                  {{scope.row.ucQuoProjectItems[0].num }} =
                  {{ (scope.row.ucQuoProjectItems[0].scoreText1 > 0 ? scope.row.ucQuoProjectItems[0].scoreText1 * scope.row.ucQuoProjectItems[0].num : '') + (scope.row.ucQuoProjectItems[0].scoreText2 > 0 ? ('(' + scope.row.ucQuoProjectItems[0].scoreText2 * scope.row.ucQuoProjectItems[0].num + ')') : '') + '分'}}<br/>
                </el-col>
              </el-col>
              <el-col :span="18" style="text-align: left;">
                {{scope.row.ucQuoProjectItems[0].content }}
              </el-col>
            </el-row>
            <el-row v-if="scope.row.chooseType ==2 ||scope.row.chooseType ==3">
              <el-col :span="24" v-for="(ucQuoProjectItem,index) in scope.row.ucQuoProjectItems" :key="'b'+ucQuoProjectItem.id">
                <el-col :span="6" style="min-height: 1px;text-align: center;">
                  <el-col :span="24" v-if="ucQuoProjectItem.num && ucQuoProjectItem.num > 0">
                    {{ucQuoProjectItem.score + '分'}} ×
                    {{ (ucQuoProjectItem.num1 > 0 ? ucQuoProjectItem.num1 : '') + (ucQuoProjectItem.num2 > 0 ? ('(' + ucQuoProjectItem.num2 + ')') : '')  }} =
                    {{ (ucQuoProjectItem.num1 > 0 ? ucQuoProjectItem.score * ucQuoProjectItem.num1 : '') + (ucQuoProjectItem.num2 > 0 ? ('(' + ucQuoProjectItem.score * ucQuoProjectItem.num2 + ')') : '') + '分'}}<br/>
                  </el-col>
                </el-col>
                <el-col :span="18" style="text-align: left;">
                  {{ucQuoProjectItem.indexStr + ' ' +ucQuoProjectItem.name}}
                </el-col>
              </el-col>
            </el-row>
          </template>
        </el-table-column>
        <el-table-column label="说明" align="center" prop="content" width="400"/>
      </el-table>

    </el-row>

    <div style="height: 30px;"></div>
    <el-row>
      <el-col :span="1">
        附件
      </el-col>
      <el-col :span="23" v-if="form.imgList && form.imgList.length > 0">
        <el-image
          v-for="img in form.imgList"
          style="height: 100px;width: 100px;"
          :src="url + img"
          fit="fill"
          :preview-src-list="imgInit.imgList"
        ></el-image>
      </el-col>

    </el-row>

    <div style="height: 60px;"></div>




  </div>
</template>
<script>
export default {
  name : "ManagementInfo",
  props: {
    queryVo:{
      type: Object
    },
  },
  dicts: ['quota_type','limit_type'],
  data() {
    return {
      url: process.env.VUE_APP_BASE_API ,
      form:{
        id:0,
        userId:0,
        ucQuoProjects:[],
        imgList:[],
      },
      imgInit:{
        imgList:[],
      },
    }
  },
  created() {
    this.searchManagementInfo(this.queryVo);
  },
  methods: {
    searchManagementInfo(queryVo) {

      this.request({
        url: '/points/applyInfo/searchManagementInfo',
        method: 'get',
        params: queryVo
      }).then(response => {
        if(response && response.data){
          this.imgInit.imgList = []
          this.form = response.data
          if(response.data.imgList && response.data.imgList.length > 0){
            response.data.imgList.forEach(img => {
              this.imgInit.imgList.push(this.url + img)
            })
            console.log(this.imgInit.imgList)
          }else{
            this.form.userId = queryVo.userId;
          }
        } else {
          this.$modal.msgError("错误");
        }
      });

    },

  }
}
</script>
<style>


</style>



